<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="sidebar">
	<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form>
		<p:growl></p:growl>
		 <h:outputText value="Assign Employees to Projects" styleClass="outputTextTitle" /> 
		<p:dataTable binding="#{assignProjectBean.dataTable}" id="dataTable" var="project" value="#{assignProjectBean.projectsList}"  
                 paginator="true" rows="10"  
                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                 rowsPerPageTemplate="5,10,15">
		<p:column>  
            <f:facet name="header">  
                <h:outputText value="Project Name" />  
            </f:facet>  
            <h:outputText value="#{project.projectName}" />  
        </p:column>  
  
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="Client Name" />  
            </f:facet>  
            <h:outputText value="#{project.client}" />  
        </p:column>  
  
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="Start Date" />  
            </f:facet>  
            <h:outputText value="#{project.periodFrom}" > 
            <f:convertDateTime pattern="dd/MM/yyyy"/> 
              </h:outputText> 
        </p:column>  
        
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="End Date" />  
            </f:facet>  
            <h:outputText value="#{project.periodTo}" > 
            <f:convertDateTime pattern="dd/MM/yyyy"/>
            </h:outputText> 
        </p:column>  
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="No of Resources" />  
            </f:facet>  
            <h:outputText value="#{project.noOfResourecs}" />  
        </p:column>  
        
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="Technology" />  
            </f:facet>  
        
        <p:selectOneMenu value="#{project.selectedModuleName}" style="width:140px;">
		<f:selectItem itemLabel="Select a Technology" itemValue="" />
		<f:selectItems value="#{project.modulesMap}" />
	 	  <p:ajax event="change" listener="#{assignProjectBean.moduleChangeListener}" update="@form">	 	
	 	  </p:ajax>
		</p:selectOneMenu>

        </p:column>   
        
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="Employee Name" />  
            </f:facet>  
           <p:selectOneMenu value="#{project.selectedEmployeeId}" style="width:140px;">
		<f:selectItem itemLabel="Select a Employee" itemValue="" />
		<f:selectItems value="#{project.employeesMap}" />
	 
		</p:selectOneMenu>
 
        </p:column>  
        
        <p:column>  
            <f:facet name="header">  
                <h:outputText value="Assign Employees" />  
            </f:facet>  
           <p:commandButton value="Assign"  actionListener="#{assignProjectBean.saveProjectAssignmentAction}" ajax="false"  />
        </p:column>  
    </p:dataTable>  
		
		</h:form>
	</ui:define>
</ui:composition>

